https://leetcode.cn/problems/combinations/description/
class Solution {
public:
    vector<vector<int>> ret;
    vector<int> path;
    int _n,_k;
    bool check[21];
    void dfs(int pos)
    {
        if(path.size()==_k)
        {
            ret.push_back(path);
            return ;
        }
        for(int i=pos;i<=_n;i++)
        {
            if(!check[i])
            {
                path.push_back(i);
                check[i]=true;
                dfs(i+1);
                //回溯
                path.pop_back();
                check[i]=false;
            }
        }

    }
    vector<vector<int>> combine(int n, int k) {
        _n=n,_k=k;
        dfs(1);
        return ret;
    }
};